﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ActionToCreateDynamicPropertyOnUndoWithDelay.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the SimpleActionNoException type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.Saf.Tests.Support.Actions
{
    using System;

    using Engine;
    using Entities;

    public class ActionToCreateDynamicPropertyOnUndoWithDelay : ActionBase<StringList>
    {
        public ActionToCreateDynamicPropertyOnUndoWithDelay(string actionName)
            : base(actionName)
        {
        }

        public ActionToCreateDynamicPropertyOnUndoWithDelay()
        {
        }

        public ActionToCreateDynamicPropertyOnUndoWithDelay(Guid id)
            : base(id)
        {
        }

        protected override ProcessStatus DoAction(SafContext context, StringList entity)
        {
            context.ActionProperties.Add("DynamicName", "New Mark Jones Do", true);
            context.ActionProperties.Add("DynamicSurname", "New Surname Do", true);
            
            return ProcessStatus.Success;
        }

        protected override ProcessStatus UndoAction(SafContext context, StringList entity)
        {
            context.ActionProperties.Add("DynamicName1", "New Mark Jones Undo", true);
            context.ActionProperties.Add("DynamicSurname1", "New Surname Undo", true);

            // remove the old properties
            context.ActionProperties.Remove("DynamicName");
            context.ActionProperties.Remove("DynamicSurname");

            return ProcessStatus.Success;
        }
    }
}